package nz.ac.massey.cs.se400_2013.ass3;

import static org.junit.Assert.*;

import org.junit.Test;

public class TestExtendedObjectStore {
	
    /**
	 * @author jmcurtis
	 */
	
	@Test
	public void test() {
		
		// adds stuff to test
		Course course = new Course();
		course.setName("MSc");
		
		Student jim = new Student();
		jim.setName("Curtis");
		jim.setFirstName("James");
		
		Paper paper = new Paper();
		paper.setId("42");
		paper.setName("paper");
		
		course.addPaper(paper);
		
		Address address = new Address();
		address.setStreet("Surf Street");
		address.setCity("Palmerston North");
		
		jim.setAddress(address);
		jim.addPaper(paper);
		jim.setCourse(course);
		
		ExtendedObjectStore visitor = ExtendedObjectStore.getInstance();
		
		ExtendedObjectStore.COURSES.add(course);
		
		assertTrue(true);
		assertTrue(visitor.getCourses().iterator().next().getName().contains("MSc"));
		assertTrue(visitor.getPapers().iterator().next().getId().contains("42"));
		assertTrue(visitor.getPapers().iterator().next().getName().contains("paper"));
		assertTrue(visitor.getStudents().iterator().next().getName().contains("Curtis"));
		assertTrue(visitor.getStudents().iterator().next().getFirstName().contains("James"));
		assertTrue(visitor.getStudents().iterator().next().getCourse().getName().contains("MSc"));
		assertTrue(visitor.getAddresses().iterator().next().getStreet().contains("Surf Street"));
		assertTrue(visitor.getAddresses().iterator().next().getCity().contains("Palmerston North"));
		assertEquals(visitor.getAddresses().iterator().next().getNo(),42);

	}
}
